package com.lwc.controller;

import com.lwc.bean.DeliveryEntryDetails;
import com.lwc.bean.GodownEntryDetails;
import com.lwc.bean.OutboundQuery;
import com.lwc.common.bean.PageBean;
import com.lwc.common.bean.ResultBean;
import com.lwc.common.controller.BaseController;
import com.lwc.service.OutboundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(tags = "出库管理")
@RequestMapping("/api")
public class OutboundController extends BaseController {

    @Autowired
    OutboundService outboundService;

@ApiOperation("按筛选查询出库")
@PostMapping("/OutboundQuery")
  public ResultBean query(@RequestBody  OutboundQuery outboundQuery){
    PageBean pageBean=outboundService.query(outboundQuery);
    return success("查询成功",pageBean);
  }


    @ApiOperation("通过出货单号id查询出库详情")
    @GetMapping("/outquery")
    public ResultBean getqueryById(int id) {
        List<DeliveryEntryDetails> list = outboundService.getqueryById(id);
        return success("查询入库详情成功", list);
    }

    @ApiOperation("出库审核同意")
    @GetMapping("/getoutById")
    public ResultBean getupdatetrue(@RequestParam(required = true) int id) {
        int rs = outboundService.getupdatetrue(id);
        return rs>0?success("更改成功"):fail("同意失败");
    }

    @ApiOperation("出库审核不同意")
    @GetMapping("/outgetupdateflaseById")
    public ResultBean getupdateflaseById(@RequestParam(required = true) int id,String reason) {
     //   int rs = outboundService.getupdateflaseById(id,reason);
       //return rs>0?success("更改成功"):fail("更改失败");
        return  success("");
    }


}
